#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <io.h>
#include<iostream>
using namespace std;
#undef UNICODE
class Directory
{
public:
  Directory();
  ~Directory();
  char* GetCurrentDirectory();
  char* GetWindowsDirectory();
  char* GetSystemDirectory();
private:
  int LEN;
  char pwdBuffer[1024];
};

char* Directory::GetSystemDirectory()
{
	//::GetSystemWindowsDirectoryA(pwdBuffer,LEN);
	::GetSystemWow64DirectoryA(pwdBuffer,LEN);
	return pwdBuffer;
}

char* Directory::GetWindowsDirectory()
{
  ::GetWindowsDirectoryA(pwdBuffer,LEN);
  return pwdBuffer;
}

Directory::Directory()
 {
	 LEN=1024;
   memset(pwdBuffer,0,LEN);
 }

Directory::~Directory()
{
	//delete[] pwdBuffer;
}

char* Directory::GetCurrentDirectory()
{
  DWORD LenCurDir;
  LenCurDir = ::GetCurrentDirectoryA(MAX_PATH + 2,pwdBuffer);
  return pwdBuffer;
}

int main()
{
  Directory *a = new Directory;
  char *p = a -> GetCurrentDirectory();
  cout<<p<<endl;
  cout<<a->GetWindowsDirectory()<<endl;
  cout<<a->GetSystemDirectory()<<endl;
  delete a;
  return 0;
}

//int main() 
//{ 
//	const int i = 123;
//	int *p = const_cast<int *>(&i);
//	cout<<*p<<endl;
//	*p=741;
//	cout<<*p<<endl;
//	cout<<i<<endl;
//	cout<<&i<<endl;
//	cout<<p<<endl;
//
//	return 0; 
//} 
